import { escapeHtml } from './escapeHtml'
import store from '../store/index'
export default {
  'richtext': {
    bind: function (el, binding, vnode) {
      el.innerHTML = escapeHtml(binding.value)
    }
  },
  'hasRole': {
    inserted: function(el, binding, vnode) {
      let roles = store.state.userInfo.roles || ['user']
      if (!roles.includes(binding.value)) {
        el.parentNode.removeChild(el)
      }
    }
  }
}

